import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:方法的创建和调用
 * User: liangyuanzhang
 * Date: 2024-12-01
 * Time: 12:54
 */
public class Work {
    public static void move(char pos1,char pos2) {
        System.out.print(pos1+"->"+pos2+" ");
    }
    public static void hanoi(int n,char pos1,char pos2,char pos3) {
        if(n == 1) {
            move(pos1,pos3);
            return;
        }
        hanoi(n-1,pos1,pos3,pos2);
        move(pos1,pos3);
        hanoi(n-1,pos2,pos1,pos3);
    }
    //递归求解汉诺塔问题
    public static void main(String[] args) {
        hanoi(1,'A','B','C');
        System.out.println();
        hanoi(2,'A','B','C');
        System.out.println();
        hanoi(3,'A','B','C');
        System.out.println();
    }


    public static int max(int a,int b) {
        return Math.max(a,b);
    }

    public static double max(double a,double b,double c) {

        double m = Math.max(a,b);
        return Math.max(m,c);
    }
    //求最大值方法的重载
    public static void main3(String[] args) {
        System.out.println(max(1,2,3));
    }

    public static int add(int a,int b){
        return a+b;
    }
    public static double add(double a,double b,double c){
        return a+b+c;
    }
    //求和的重载
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()){
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            System.out.println("两个整数之和:"+add(x,y));
        }
            double x = scanner.nextDouble();
            double y = scanner.nextDouble();
            double z = scanner.nextDouble();
            System.out.println("三个个小数之和:"+add(x,y,z));
    }

    //使用函数求最大值

    //求2个数的最大值
    public static int max2(int a,int b){
        return a > b ? a:b;
    }
    //求3个数的最大值
    public static int max3(int a,int b,int c){
        int max = max2(a,b);
        return max > c ? max:c;
    }
    public static void main1(String[] args) {
        System.out.println(max3(2,5,1));
    }
}
